<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%  
String path = request.getContextPath();  
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>档口分布</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=yes" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/platform.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
</head>
<body>
<div class="viewport">
    <div class="header">
       <div class="header-1">
           <a href="javascrpt:void(0)" id="join" class="header-2">
              <span id="account" class="account">${empty user.realName ? '' : user.realName}</span>&nbsp;&nbsp;<span id="deptName" class="deptName">${user.departmentName}</span>
           </a>
           <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=store&prefix=3g_platform_shop-rent_op&entrance=yes" class="back" id="back">返回</a>
           <span class="span-num">WWP32000</span>
       </div>
    </div>
    <div class="content m-top">
        <div class="hr-1"></div>
        <div class="fix">
            <div class="fix-1">
                <a href="/wape-web/api/core/centerService?serviceCode=MMZS21201&fatherType=10" class="fix-1-1 ${fatherType == '10' ? 'li-active' : ''}">大棚经营区</a>
                <a href="/wape-web/api/core/centerService?serviceCode=MMZS21201&fatherType=20" class="fix-1-1 ${fatherType == '20' ? 'li-active' : ''}">蔬菜经营区</a>
                <a href="/wape-web/api/core/centerService?serviceCode=MMZS21201&fatherType=30" class="fix-1-1 ${fatherType == '30' ? 'li-active' : ''}">水果经营区</a>
                <a href="/wape-web/api/core/centerService?serviceCode=MMZS21201&fatherType=40" class="fix-1-1 ${fatherType == '40' ? 'li-active' : ''}">海鲜经营区</a>
                <a href="/wape-web/api/core/centerService?serviceCode=MMZS21201&fatherType=50" class="fix-1-1 ${fatherType == '50' ? 'li-active' : ''}">冻品经营区</a>
                <a href="/wape-web/api/core/centerService?serviceCode=MMZS21201&fatherType=60" class="fix-1-1 ${fatherType == '60' ? 'li-active' : ''}">干货副食区</a>
            </div> 
        </div>
        <div class="blank-m"></div>
        
        <c:forEach items="${markets}" var="mk">
        <div class="blank-2"></div>
        <div class="layout-1">
            <div class="layout-1-1">
                <span class="span-1"><span><b>${mk.storeName}</b></span>&nbsp;&nbsp;<span>建设面积：${mk.totalArea}m²</span></span>
                <span class="span-2"><span>铺位数：${mk.storeRemark}个</span>&nbsp;&nbsp;<span>已出租：${mk.leaseNum}个</span></span>
            </div>
            <div class="blank"></div>
            <div class="layout-1-2">
                <ul>
                   <c:forEach items="${stores}" var="st">
                      <c:if test="${st.fatherId == mk.storeId}">
                         <li class="gray"><a href="/wape-web/api/core/centerService?serviceCode=MMZS21204&storeId=${st.storeId}&topMarket=${mk.fatherName}&fatherRemark=${mk.storeRemark}&fatherTotalArea=${mk.totalArea}"><span style="font-size:8px;float:left;display:inline-block;width:100%;height:8px;text-align:left;"></span><span style="display:inline-block;width:100%;height:24px;line-height:24px;font-size:14px;">${st.storeName}</span></a></li>
                      </c:if>
                   </c:forEach>
                   <li class="add gray" id="${mk.storeId}_${mk.storeName}_${mk.storeLevelNum}_${mk.storeType}_${mk.fatherName}_${mk.storeRemark}_${mk.totalArea}"><a href="javascript:void(0)">✚</a></li>
                </ul>
            </div>
        </div>
        </c:forEach>
        
    </div>
</div>
</body>
<script type="text/javascript">
   /*错误提示*/
   $(function(){
       var error = "${requestScope.returnMsg}";
       if(error != "" && error != "成功!"){
           layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
       }
   });
   /*Tab*/
   $(function(){
	   if(screen.width<1000){
		   $(".fix-1").animate({scrollLeft:$(".li-active").offset().left-100}, 0);
       }
   });
   /*添加铺位*/
   $(function(){
	   $(".add").click(function(){
   		   var title = $(this);
   		   var obtain = $(this).attr("id");
		   layer.prompt({
               title: '请输入商铺号',
               formType: 0
           }, function(text){
               if(text != ""){
            	   layer.closeAll()
                   layer.load();
                   var obs = obtain.split("_");
                   $.ajax({
                       type:"post",
                       url:"/wape-web/api/core/centerService",
                       data:{
                           serviceCode:"MMZS21202",
                           storeName:text,
                           fatherId:obs[0],
                           fatherName:obs[1],
                           fatherLevelNum:obs[2],
                           fatherType:obs[3]
                       },
                       success:function(data){
                           var add = eval("("+data+")");
                           if(add.returnCode == "200"){
                        	   var odd = eval("("+add.result+")");
                        	   layer.closeAll();
                        	   title.before("<li class='gray'><a href='/wape-web/api/core/centerService?serviceCode=MMZS21203&storeId=" + odd.storeId + "&topMarket=" + obs[4] +"&fatherRemark=" + obs[5] + "&fatherTotalArea=" + obs[6] + "'><span style='font-size:8px;float:left;display:inline-block;width:100%;height:8px;text-align:left;'></span><span style='display:inline-block;width:100%;height:24px;line-height:24px;font-size:14px;'>"+text+"</span></a></li>")
                           }
                           else{
                        	   layer.closeAll();
                               layer.msg(returnMsg,{shadeClose:true,shade:0.1,time:2000});
                           }
                       }
                   }); 
               }
               else{
            	   layer.closeAll();
            	   layer.msg("添加失败!",{shadeClose:true,shade:0.1,time:2000});
               }
           });
	   });
   });
</script>

</html>


